<template>
  <div class="demo-input-suffix">
    所属断面
    <el-select v-model="value" placeholder="请选择" @change="towerChange">
      <el-option
        v-for="item in sectionList"
        :key="item.id"
        :label="item.sectionName"
        :value="item.id"
      ></el-option>
    </el-select>
    <el-button icon="el-icon-search" class="selectSection" type="primary">查询</el-button>
    <el-button icon="el-icon-plus" class="save" @click="addProductHandle" type="primary">添加</el-button>
    <el-button icon="el-icon-upload" class="save" @click="ImportData" type="primary">导入数据</el-button>
  </div>
</template>

<script>
import api from '../../../api'
export default {
  data() {
    return {
      flag: false,
      sId: '',
      wId: '',
      sectionList: [],
      value: '--全部--'
    }
  },
  mounted() {
    this.$bus.$on('onAddMonitorInfoWid', (flag) => {
      this.wId = flag
      this.findByTunnelSction(flag)
    })
  },
  methods: {
    
    findByTunnelSction(wid) {
      api
        .tunnelSectionfindByWid({ wid })
        .then((res) => {
          if ((res.data.code = 2001)) {
            this.sectionList = res.data.data
          }
        }).catch((err) => {
          console.log(err)
        })
    },
    addProductHandle() {
      this.$bus.$emit('onAddMonitorInfo', true)
    },
    ImportData() {
      this.$bus.$emit('onAddMonitorInfoUploadShow', true)
    },
    towerChange(e) {
      this.$bus.$emit('onRefreshmonitorMeasuremen', { wId: this.wId, sId: e })
    }
  }
}
</script>

<style scoped>

.selectSection{
  margin-left: 10px;
}

.demo-input-suffix {
  text-align: left;
  width: 100%;
  height: 60px;
  background-color: #fff;
  padding-left: 10px;
  padding-top: 10px;
  margin-bottom: 10px;
  color: #606266;
}
.select{
  margin-left: 10px;
}

.save{
   margin-left: 10px;
   border: none;
   border: 2px solid #409EFF;
   background-color: white;
   color: #409EFF;
   height: 40px;
    padding-top: 10px;
}
.ImportData{
  margin-left: 10px;
  border: none;
  border: 2px solid #409eff;
  background-color: white;
  color: #409eff;
}
</style>